{{!--
Copyright (C) 2017 Draios inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
--}}

{{#if promiseState.isLoading}}
    <div class="sd-promise-wait-overlay__wrapper">
        <div class="sd-promise-wait-overlay__loading-panel">
            {{number-to-string promiseState.loadingProgress decimalCount=1 op="%"}}
        </div>
    </div>
{{/if}}

{{#if promiseState.hasFailed}}
    <div class="sd-promise-wait-overlay__wrapper">
        <div class="sd-promise-wait-overlay__empty-panel">
            <div class="sd-promise-wait-overlay__text">
                Unable to load data
            </div>
            {{#if promiseState.error.message}}
                <div class="sd-promise-wait-overlay__message">
                    {{promiseState.error.message}}
                </div>
            {{/if}}
        </div>
    </div>
{{/if}}

{{#if canShowData}}
    {{yield}}
{{/if}}

{{#if promiseState.hasNoData}}
    <div class="sd-promise-wait-overlay__wrapper">
        <div class="sd-promise-wait-overlay__empty-panel">
            <div class="sd-promise-wait-overlay__text">
                No data
            </div>
            {{#if emptyMessage}}
                <div class="sd-promise-wait-overlay__message">
                    {{emptyMessage}}
                </div>
            {{/if}}
        </div>
    </div>
{{/if}}
